package com.hrhx.springboot.web;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.hrhx.springboot.domain.IdCard;
import com.hrhx.springboot.service.IdCardService;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value = "/idcard")
public class IdCardController {
	
	@Autowired
	private IdCardService idCardService;
	
	@ApiOperation(value = "根据身份证码获取信息", notes = "获取前六位Code返回地理位置")
	@ApiImplicitParams({
        @ApiImplicitParam(name = "idCard", value = "地理详细信息", required = false, dataType = "IdCard")
	})
	@RequestMapping(value = "/query", method = RequestMethod.GET)
	public String getByParentId(@ModelAttribute IdCard idCard) throws IOException {
		return idCardService.getIdCardByIdSix(idCard.getSixCode());
	}
}
